home *** CD-ROM | disk | FTP | other *** search
- _ML AND COLORED PETRI NETS FOR MODELING AND SIMULATION_
- by Peter D. Varhol
-
- [LISTING ONE]
-
-
- (* A list generator for the processes *)
-
- fun listGenerator start next 0 = nil
- | listGenerator start next n = start ::
- listGenerator (next start) next (n - 1)
-
-
- (* Random number generator. Uses the congruence method. *)
-
- fun random seed = let val x = (power 7.0 9.0) * seed mod (power 10.0 10.0)
- in x - real(floor x)
- end;
- val seed = random seed;
-
-
- (* Seed value for the random number generator. This number should *)
- (* be changed for every simulation run to produce a different random *)
- (* number list. *)
-
- val seed = .5
-
-
- (* Functions to produce the list of random numbers. Calls the list *)
- (* and the random number function, and places the results in randomList. *)
-
- fun proclist n seed = listGenerator seed random n;
- fun ranint a b c = floor(x * real(b - a + 1)) + a;
- fun randomList = x yx z seed = map(randint x y) (proclist z seed);
-
-
- (* Part of a sample processor in the multiprocessor system. CountDown *)
- (* is a recursive function that serves as the relative time clock. *)
-
- fun processorOne randomList = countDown (map(randomList))
- statistics randomList;
-